<?php

class MoneyController extends Application_Model_Controller
{

    public function init()
    {
        $this->view->headScript()->appendFile($this->view->baseUrl() . '/js/money.js');
        $this->view->headScript()->appendFile('/js/highcharts.js');
        $this->view->headScript()->appendFile('http://code.highcharts.com/modules/exporting.js');

        $this->view->headTitle('Финансы');
    }

    public function indexAction()
    {
        $mapperProfit = new Application_Model_ProfitMapper();
        $statsProfit = $mapperProfit->getStatsProfit();
//      view
        $this->view->statsProfit   = $statsProfit;
        $this->view->planeProfit = isset(Application_Model_ProfitMapper::$profitPlane[date('Y')]) ? Application_Model_ProfitMapper::$profitPlane[date('Y')] : false;
        $mapperDebts = new Application_Model_DebtMapper();
        $this->view->debtsSum = $mapperDebts->getSumDebts();
        $this->view->tplSidebar = 'money.phtml';
    }
}
